﻿@{
    ViewBag.Title = "ClientNewsList";
}

<div id="cphMain_ctl00_ContentPane" class="center">
    <div id="Breadcrumb" class="Breadcrumb">
        <ul>
            <li class="first">
                <a href='javascript:;' onclick="javascript:loadAction('Index2','Main')">Trang chủ
                </a>
            </li>
            <li>
                <a href='javascript:;' onclick="javascript:loadAction('personal','Account')">Tài khoản của tôi
                </a>
            </li>
            <li>
                <span>Tin tức mới nhất</span>
            </li>
        </ul>
    </div>

    <div class="Account-Module DefaultModule">

        <div class="Block DefaultModule">


            <div id="CartHeader" class="Block Moveable Panel">
                <h2>&nbsp;
                </h2>
            </div>

            <div id="CartContainer" class="Block Moveable Panel">
                @if (Model != null)
                { 
                    <div class="BlockContent">


                        <div class="Clear">
                        </div>
                        <div>
                            @foreach (var news in Model)
                            {
                                <div class="defaultTitle LoginForm-title" style="height: 100%;">
                                    <h1>@news.title</h1>
                                </div>
                                <span>Ngày viết: @news.post_date</span>
                                <div style="margin-top: 10px;">
                                    @Html.Raw(news.body)
                                </div>
                                <div style="float: right">
                                    <a href="javascript:;" onclick="javascript:loadActionData('NewsDetail','Main','id=@news.ID')" class="myBtn1">Xem thêm</a>
                                </div>
                                <div class="Clear" style="border-bottom: 5px;border-bottom-style: inset;margin-bottom: 15px;margin-top: 30px;">
                                </div>
                                
                            }
                        </div>
                    </div>

                    <div class="PageNavigation" style="padding-bottom: 10px; padding-top: 10px;" align="center">
                        @{var previousPage = Math.Max(ViewBag.currentPage - 1, 1);}
                        <a  href="javascript:;" onclick="javascript:loadActionData('newsList','Admin','pageNum=@previousPage')">&lt;&lt;</a>
                        @for (int num = 1; num <= ViewBag.maxPage; num++)
                        {
                            if (ViewBag.currentPage == num)
                            {
                            <a class="active" href="#"
                                style="background-color: gray; color: white;"><strong>@num</strong></a>
                            }
                            else
                            {
                            <a  href="javascript:;" onclick="javascript:loadActionData('newsList','Admin','pageNum=@num')">@num</a>    
                            }
                        }
                        @{var nextPage = Math.Min(ViewBag.maxPage, ViewBag.currentPage + 1);}
                        <a href="javascript:;" onclick="javascript:loadActionData('newsList','Admin','pageNum=@nextPage')">&gt;&gt;</a>
                    </div>
                }
                else
                {
                    <div class="BlockContent">
                        <h1>Không có bài viết nào</h1>
                    </div>
                }
            </div>
        </div>
    </div>
</div>

